// JavaScript Document
//var songLine;
//var songList;

//var str;

function makePost(songTitle)
{
	$.ajax({
		url:"https://docs.google.com/document/d/1ZgK6wlm3xjN_ctv3wikAEfonirqcB_qGe73p-rDwRmI/export?format=txt",
		dataType: "html",
		success:function(result){
			$("#doc").val(result);
			str = $("#doc").val();
			songList = str.split("\n");
			for(var i = 0; i<songList.length; i++)
			{
				songLine = songList[i].split(",");		
				if(songLine[1] == "Westlife - Something Right")
				{					
					var s = '<br /><iframe allowfullscreen="allowfullscreen" frameborder="0" height="480" src="' + songLine[3] +'" width="720"></iframe>'
					$("#youtube").html(s);
					break;
				}
			}
		}
	});	
}

function makePage(songTitle)
{
	$.ajax({
		url:"https://docs.google.com/document/d/1ZgK6wlm3xjN_ctv3wikAEfonirqcB_qGe73p-rDwRmI/export?format=txt",
		dataType: "html",
		success:function(result){
			$("#doc").val(result);
			str = $("#doc").val();
			songList = str.split("\n");
			for(var i = 0; i<songList.length; i++)
			{
				songLine = songList[i].split(",");		
				if(songLine[1] == "Westlife - Something Right")
				{			
					var s = '<iframe allowfullscreen="allowfullscreen" frameborder="0" height="512" src="'+ songLine[4] +'" width="910"></iframe>';			
					$("#drive").html(s);			
				}
				break;
			}
		}
	});		
}


function proceedPage(songTitle)
{
	for(var i = 0; i<songList.length; i++)
	{
		songLine = songList[i].split(",");		
		if(songLine[1] == "Westlife - Something Right")
		{			
			var s = '<iframe allowfullscreen="allowfullscreen" frameborder="0" height="512" src="'+ songLine[4] +'" width="910"></iframe>';			
			$("#drive").html(s);			
		}
	}
}

function chia(s)
{
	songList = s.split("\n");	
	//alert(songList[0]);
	
}

function proceedPost(songTitle)
{
	//alert(songTitle);
	for(var i = 0; i<songList.length; i++)
	{
		songLine = songList[i].split(",");		
		if(songLine[1] == "Westlife - Something Right")
		{
			alert("Video Matched");
			alert(songLine[3]);
			var s = '<br /><iframe allowfullscreen="allowfullscreen" frameborder="0" height="480" src="' + songLine[3] +'" width="720"></iframe>'
			
			//var s = '<iframe width="560" height="315" src="http://www.youtube.com/embed/L1sAdoQAxsA" frameborder="0" allowfullscreen></iframe>'
			$("#youtube").html(s);
			//break;
		}
	}
}